home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 119
/
(Vol 119) Nov 09 2010.iso
/
TGKI-109
/
Games
/
agent_platformer.swf
/
scripts
/
frame_3
/
DoAction.as
Wrap
Text File
|
2010-11-09
|
8KB
|
229 lines
function update()
{
player._x = 40;
player._y = 40;
forecast_x = 40;
forecast_y = 40;
rcan = false;
jumping = false;
has_jetpack = true;
using_jetpack = false;
jet_bar.jet_bar_inside._width = 109;
xspeed = 0;
yspeed = 0;
max_yspeed = 10;
walk_speed = 4;
climb_speed = 2;
jet_speed = 3;
using_jetpack = false;
has_jetpack = true;
climbing = false;
jumping = false;
can_jump = true;
gravity = 1;
jump_power = 10;
walking_while_jumping = true;
show_score = "Coins : " + score;
rgain = 0;
_root.lava.removeMovieClip();
_root.exit_door.removeMovieClip();
_root.lev.removeMovieClip();
_root.moving.removeMovieClip();
_root.lad.removeMovieClip();
_root.lasers.removeMovieClip();
_root.coins.removeMovieClip();
_root.createEmptyMovieClip("exit",_root.getNextHighestDepth());
_root.createEmptyMovieClip("lev",_root.getNextHighestDepth());
_root.createEmptyMovieClip("lad",_root.getNextHighestDepth());
_root.createEmptyMovieClip("lava",_root.getNextHighestDepth());
_root.createEmptyMovieClip("moving",_root.getNextHighestDepth());
_root.createEmptyMovieClip("coins",_root.getNextHighestDepth());
_root.createEmptyMovieClip("lasers",_root.getNextHighestDepth());
lad.swapDepths(_root.player);
coins.swapDepths(_root.player);
decay = false;
y = 0;
while(y <= 14)
{
x = 0;
while(x <= 24)
{
if(level1[y][x] == 1)
{
place_brick = lev.attachMovie("block","block_" + lev.getNextHighestDepth(),lev.getNextHighestDepth(),{_x:x * 20 + 10,_y:y * 20 + 10});
place_brick.gotoAndStop(level1[y][x]);
}
if(level1[y][x] == 2)
{
ladder_brick = lad.attachMovie("block","block_" + lad.getNextHighestDepth(),lad.getNextHighestDepth(),{_x:x * 20 + 10,_y:y * 20 + 10});
ladder_brick.gotoAndStop(level1[y][x]);
}
if(level1[y][x] == 3)
{
lava_brick = lava.attachMovie("block","block_" + lava.getNextHighestDepth(),lava.getNextHighestDepth(),{_x:x * 20 + 10,_y:y * 20 + 10});
lava_brick.gotoAndStop(level1[y][x]);
}
if(level1[y][x] == 4)
{
moving_brick = moving.attachMovie("block","block_" + moving.getNextHighestDepth(),moving.getNextHighestDepth(),{_x:x * 20 + 10,_y:y * 20 + 10});
moving_brick.gotoAndStop(level1[y][x]);
moving_brick.dir = 1;
moving_brick.onEnterFrame = function()
{
this._x += this.dir;
if(_root.lev.hitTest(this._x + 11,this._y,true) and this.dir > 0 or _root.lev.hitTest(this._x - 10,this._y,true) and this.dir < 0)
{
this.dir *= -1;
}
if(_root.player.hitTest(this._x,this._y - 11,true) or _root.player.hitTest(this._x + 5,this._y - 11,true) or _root.player.hitTest(this._x - 5,this._y - 11,true))
{
player._x += this.dir;
}
};
}
if(level1[y][x] == 5)
{
exit_door = exit.attachMovie("block","block_" + exit.getNextHighestDepth(),exit.getNextHighestDepth(),{_x:x * 20 + 10,_y:y * 20 + 10});
exit_door.gotoAndStop(level1[y][x]);
}
if(level1[y][x] == 6)
{
coin = coins.attachMovie("block","block_" + coins.getNextHighestDepth(),coins.getNextHighestDepth(),{_x:x * 20 + 10,_y:y * 20 + 10});
coin.gotoAndStop(level1[y][x]);
coin.onEnterFrame = function()
{
if(_root.player.hitTest(this._x,this._y,true) or _root.player.hitTest(this._x + 5,this._y - 11,true) or _root.player.hitTest(this._x - 5,this._y - 11,true))
{
score++;
rgain++;
if(jet_bar.jet_bar_inside._width < 108)
{
using_jetpack = false;
has_jetpack = true;
jet_bar.jet_bar_inside._width += 2;
}
removeMovieClip(this);
}
};
}
if(level1[y][x] == 7)
{
laser = lasers.attachMovie("block","block_" + lasers.getNextHighestDepth(),lasers.getNextHighestDepth(),{_x:x * 20 + 10,_y:y * 20 + 10});
laser.gotoAndStop(level1[y][x]);
}
x++;
}
y++;
}
}
stop();
if(son_ == undefined)
{
if(my_sound == undefined)
{
var my_sound = new Sound();
my_sound.attachSound("sound");
my_sound.start(0,99999);
}
stimer = 0;
sup = true;
son_ = true;
}
bgs.onEnterFrame = function()
{
site.onRelease = function()
{
getUrl("http://www.granttitus.com", "");
};
if(sup == true)
{
stimer++;
}
if(Key.isDown(77))
{
if(son_ == true and stimer > 5)
{
sound.removeMovieClip();
stopAllSounds();
stimer = 0;
sup = true;
son_ = false;
}
if(son_ == false and stimer > 5)
{
var _loc1_ = new Sound();
_loc1_.attachSound("sound");
_loc1_.start(0,99999);
stimer = 0;
sup = true;
son_ = true;
}
}
};
attachMovie("cover","cover",_root.getNextHighestDepth());
cover._alpha = 100;
cover.onEnterFrame = function()
{
this._alpha -= 6;
if(this._alpha <= 0)
{
removeMovieClip(this);
}
};
_root.lasers.removeMovieClip();
_root.lava.removeMovieClip();
_root.exit_door.removeMovieClip();
_root.lev.removeMovieClip();
_root.moving.removeMovieClip();
_root.lad.removeMovieClip();
_root.jet_bar.removeMovieClip();
_root.player.removeMovieClip();
_root.coins.removeMovieClip();
level1 = new Array();
_root.createEmptyMovieClip("exit",_root.getNextHighestDepth());
_root.createEmptyMovieClip("lev",_root.getNextHighestDepth());
_root.createEmptyMovieClip("lad",_root.getNextHighestDepth());
_root.createEmptyMovieClip("lava",_root.getNextHighestDepth());
_root.createEmptyMovieClip("moving",_root.getNextHighestDepth());
_root.createEmptyMovieClip("coins",_root.getNextHighestDepth());
level1[0] = new Array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
level1[1] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level1[2] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level1[3] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level1[4] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level1[5] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level1[6] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level1[7] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level1[8] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level1[9] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1);
level1[10] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level1[11] = new Array(1,0,0,0,0,0,1,0,0,1,0,0,1,1,1,1,0,0,0,0,0,0,0,1,1);
level1[12] = new Array(1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1);
level1[13] = new Array(1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1);
level1[14] = new Array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
update();
start_btn.onRelease = function()
{
_root.lava.removeMovieClip();
_root.exit_door.removeMovieClip();
_root.lev.removeMovieClip();
_root.moving.removeMovieClip();
_root.lad.removeMovieClip();
_root.jet_bar.removeMovieClip();
_root.player.removeMovieClip();
_root.coins.removeMovieClip();
_root.gotoAndStop("chose");
};
ins_btn.onRelease = function()
{
_root.lava.removeMovieClip();
_root.exit_door.removeMovieClip();
_root.lev.removeMovieClip();
_root.moving.removeMovieClip();
_root.lad.removeMovieClip();
_root.jet_bar.removeMovieClip();
_root.player.removeMovieClip();
_root.coins.removeMovieClip();
_root.gotoAndStop("ins");
};